﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

//游戏公共控制器
public class GameController : MonoBehaviour {

	public static GameController initialize;
	public float backgroundSpeed = -1.5f;

	public Text scoreText;
	private int score = 0;

	public bool gameIsOver = false;

	private void Awake() {
		if (initialize == null) {
			initialize = this;
		} else if (initialize != this) {
			Destroy(initialize);
		}
	}

	public void addScore() {
		score++;
		scoreText.text = "Score: " + score;
	}

	//对象移动
	public void gameObjectMove(GameObject gameObject) {
		gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(backgroundSpeed, 0.0f);
	}

}
